<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            position: relative;
            width: 600px;
            height: 400px;
            overflow: hidden;
        }
        .img{
            width: 1800px;
            height: 400px;
            transition: 0.3s;
        }
        img{
            width: 600px;
            height: 370px;
            float: left;
        }
        .but{
            position: absolute;
            left: 0px;
            bottom: 0px;
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="img">
            <img src="1.jpg" alt="">
            <img src="2.jpg" alt="">
            <img src="3.jpg" alt="">
        </div>
        <div class="but">
            <button>1</button>
            <button>2</button>
            <button>3</button>
        </div>
    </div>
    
    <script>
        let but=document.querySelectorAll("button");
        let img=document.querySelector(".img");
        for(let i=0;i<but.length;i++){
            but[i].onclick=function(){
                img.style.transform=`translate(${-600*i}px)`
            }
        }
    </script>
</body>
</html>